package com.service.bank.feign;

import com.client.model.pojo.bank.ArBankcard;
import com.client.model.vo.common.Result;
import com.client.model.vo.common.ResultCodeEnum;
import com.service.bank.service.ArBankcardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author : RulerWood
 * @Data : 2024/4/6 - 17:50
 */
@RestController
@RequestMapping("/airui/api/creditcardFeign")
public class CreditCardFeignController {
    @Autowired
    private ArBankcardService arBankcardService;

    @GetMapping("/{cid}")
    public Result<ArBankcard> getCreditCardById(@PathVariable("cid") Long cid) {
        return Result.build(this.arBankcardService.getOptById(cid), ResultCodeEnum.SUCCESS);
    }

    @PostMapping("/")
    public Result savePrice(@RequestBody ArBankcard arBankcard) {
        return Result.build(this.arBankcardService.saveOrUpdate(arBankcard), ResultCodeEnum.SUCCESS);
    }

    @PostMapping("/pwdIsRight")
    public Result<ArBankcard> pwdIsRight(String password){
        return this.arBankcardService.pwdIsRight(password);
    }
    @GetMapping("/findBankCardByCardNum")
    public ArBankcard getBankCardByCardNum(@RequestParam(name = "cardNum") String cardNum){
        return this.arBankcardService.getBankCardByCardNum(cardNum);
    }
    @GetMapping("/findCreditCardByCardNum")
    public ArBankcard getCreditCardByCardNum(@RequestParam(name = "cardNum") String cardNum,@RequestParam("password") String password){
        return this.arBankcardService.getCreditCardByCardNum(cardNum,password);
    }
}
